package com.harveyguo.nihonngo.controller;

import com.harveyguo.nihonngo.model.dto.CourseCreateDto;
import com.harveyguo.nihonngo.model.dto.CourseDto;
import com.harveyguo.nihonngo.model.mapper.CourseMapper;
import com.harveyguo.nihonngo.model.mapper.UserMapper;
import com.harveyguo.nihonngo.service.CourseService;
import com.harveyguo.nihonngo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/course")
public class CourseController {
    CourseService   courseService;
    CourseMapper  courseMapper;

    @GetMapping("/all")
    private List<CourseDto> findAll () {
        return courseService.list();
    }

    @PostMapping("/create")
    private CourseDto  creatCourse (@RequestBody CourseCreateDto courseDto){
        return  courseService.createdCourse(courseDto);
    }

    @Autowired
    public void setCourseService(CourseService courseService) {
        this.courseService = courseService;
    }

    @Autowired
    public void setUserMapper(CourseMapper courseMapper) {
        this.courseMapper = courseMapper;
    }
}
